Fix for leak when window destroyed
authorMichael David Emmel <memmel@src.gnome.org>
Tue, 2 Jan 2007 09:05:54 +0000 (09:05 +0000)
committerMichael David Emmel <memmel@src.gnome.org>
Tue, 2 Jan 2007 09:05:54 +0000 (09:05 +0000)
svn path=/trunk/; revision=17014

ChangeLog
gdk/directfb/gdkwindow-directfb.c

index 8a239ce1374bf550540e1960c0c3dd52c616e0a5..da2ef38b87aca2beb747dacbea1fe67450bcea60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-01-02  Michael Emmel  <mike.emmel@gmail.com>
+
+       * gdkwindow-directfb.c: fixed leak of dfb resource on destroy 
+
 2007-01-01  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkscrolledwindow.h:
index 0a683de033157b9e5a684354a5e509ae82905ee6..9c40031642eacc8508e73c82d7d5aeb8da276214 100644 (file)
@@ -113,7 +113,7 @@ gdk_window_schedule_update (GdkWindow *window)
 
   if (!update_idle)
     {
-      update_idle = gdk_threads_add_idle (GDK_PRIORITY_REDRAW,
+      update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
                                     gdk_window_update_idle, NULL, NULL);
     }
 }
@@ -606,20 +606,23 @@ _gdk_windowing_window_destroy (GdkWindow *window,
   if (window == gdk_directfb_focused_window)
     gdk_directfb_change_focus (NULL);
 
+
+  if (impl->drawable.surface) {
+    GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
+    if(dimpl->cairo_surface) {
+      cairo_surface_destroy(dimpl->cairo_surface);
+      dimpl->cairo_surface= NULL;
+    }
+    impl->drawable.surface->Release (impl->drawable.surface);
+    impl->drawable.surface = NULL;
+  }
+
   if (!recursing && !foreign_destroy && impl->window ) {
        impl->window->SetOpacity (impl->window,0);
                impl->window->Close(impl->window);
        impl->window->Release(impl->window);
+        impl->window = NULL;
   }
-
-#if 0 /* let the finalizer kill it */
-  if (!recursing && !foreign_destroy)
-    {
-               if (impl->window)
-               impl->window->Destroy (impl->window);
-               impl->window = NULL;
-       }
-#endif
 }
 
 /* This function is called when the window is really gone.
@@ -1263,15 +1266,15 @@ _gdk_directfb_move_resize_child (GdkWindow *window,
 
   if (!private->input_only)
     {
-      if (impl->drawable.surface)
-        {
-          GdkDrawableImplDirectFB *dimpl;
-          dimpl    = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
-          impl->drawable.surface->Release (impl->drawable.surface);
-          impl->drawable.surface = NULL;
-          cairo_surface_destroy(dimpl->cairo_surface);
-          dimpl->cairo_surface= NULL;
-        }
+    if (impl->drawable.surface) {
+      GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
+      if(dimpl->cairo_surface) {
+        cairo_surface_destroy(dimpl->cairo_surface);
+        dimpl->cairo_surface= NULL;
+      }
+    impl->drawable.surface->Release (impl->drawable.surface);
+    impl->drawable.surface = NULL;
+  }
 
       parent_impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (private->parent)->impl);